<template>
  <ex-dialog width="900px" class="ex-diolog" :title="title" :visible="visible" :close-on-click-modal="true"
    @closeDialog="handleClose">
    <div class="main" v-loading="loading">
      <p style="margin: 0 0px 14px">订单编号：{{id}}</p>
      <!-- 数字宝箱 -->
      <el-table v-loading="loading" :data="tabList" stripe border v-if="orderType=='1'">
        <el-table-column label="序号" align="center" type="index" width="64px" />
        <el-table-column label="产品名称" align="center" prop="couponName" />
        <el-table-column label="券码" align="center" prop="couponNo" />
        <el-table-column label="券有效期" align="center" prop="orderType" width="154px" :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <p>{{scope.row.validityStartTime}}</p>
            <p>{{scope.row.validityEndTime}}</p>
          </template>
        </el-table-column>
        <el-table-column label="券状态" align="center" prop="status" :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <dict-tag :options="orderCouponStatus" :value="scope.row.status" />
          </template>
        </el-table-column>
        <el-table-column label="核销店铺" align="center" prop="verificationShopName" />
        <el-table-column label="核销时间" align="center" prop="verificationTime" width="100px" />
      </el-table>
      <!-- 第三方 -->
      <el-table v-loading="loading" :data="tabList" stripe border v-if="orderType=='2'">
        <el-table-column label="序号" align="center" type="index" width="64px" />
        <el-table-column label="第三方id" align="center" prop="productId" />
        <el-table-column label="名称" align="center" prop="productName" />
        <el-table-column label="券码" align="center" prop="thirdBusinessParam" />
        <el-table-column label="充值手机号" align="center" prop="account" />
        <el-table-column label="购买店铺" align="center" prop="buyShopName" />
      </el-table>
    </div>
  </ex-dialog>
</template>
<script>
  import Loading from "@/components/Loading/index";
  // api
  import {
    orderBoxDetail,
    orderThirdPartyDetail,
  } from "@/api/consumeMiningManagement/clockingActivityOrder";

  export default {
    components: {
      Loading,
    },
    props: {
      visible: Boolean,
      id: String,
      orderType: String, // 1:数字宝箱  2:第三方
    },
    data() {
      return {
        labelWidth: '100px',
        inputWidth: '300px',
        title: '券码详情',
        loading: false,
        disabled: false,
        AgreeLoading: false, //按钮loading
        innerVisible: false,
        tabList: [],
        // 查询参数
        queryParams: {},
        orderCouponStatus: [],//券状态下拉
      };
    },
    computed: {},
    created() {
      this.getOrderCouponStatus()
      if (this.orderType == '1') {
        this.title = '券码详情（数字宝箱）'
        this.getOrderBoxDetail()
      } else {
        this.title = '券码详情（第三方充值）'
        this.getOrderThirdPartyDetail()
      }
    },
    mounted() {

    },
    methods: {
      //取消
      handleClose(formName) {
        this.$emit("update:visible", false);
      },
      //获取订单状态字典
      getOrderCouponStatus() {
        var dictType = "shenye_customer_coupon_status";
        this.$getSelectList(dictType)
          .then((res) => {
            var arr = [{
              id: "",
              value: "全部",
            }, ];
            this.orderCouponStatus = arr.concat(res.result[0].dictList);
          })
          .finally(() => {
            this.loading = false;
          });
      },
      /** 查询数字宝箱列表 */
      getOrderBoxDetail() {
        this.loading = true;
        orderBoxDetail(this.id).then(response => {
          this.tabList = response.result;
          this.loading = false;
        });
      },
      /** 查询第三方列表 */
      getOrderThirdPartyDetail() {
        this.loading = true;
        orderThirdPartyDetail(this.id).then(response => {
          this.tabList = response.result;
          this.loading = false;
        });
      },
    },
  };

</script>
<style lang="scss" scoped>
  .ex-diolog {
    ::v-deep .ex--dialog--footer {
      border: none !important;
      padding: 0 !important;
    }

    ::v-deep .ex--dialog--main {
      padding: 10px 20px !important;
    }
  }
  .main{
    padding: 0 0 30px;
  }
  .button_box {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
  }

</style>
